<div id="content" class="clearfix">
  <h3><?php echo nl2br($this->title); ?></h3>
  <div class="section">
    <!--<H5 class=border>终端录入</H5>-->
    <p><span class="require">*</span>为必须输入项</p>
<?php $form=$this->beginWidget('ActiveForm', array(
	'id'=>'newtreaty-form',
	'enableClientValidation'=>true,
	'clientOptions'=>array(
		'validateOnSubmit'=>false,
	),
)); ?>    
<!--    <form enctype="multipart/form-data" action="" method="post" >-->
      <table width="100%" border="0" cellpadding="0" cellspacing="0" class="normal">
        <tr>
          <th width="25%" align="left"><?php echo $form->label($model,'trade_date'); ?></th>
          <td>
<?php  if(Yii::app()->user->checkAccess('MENU2_HYXSLR_WY'))
{
$this->widget('zii.widgets.jui.CJuiDatePicker',array(  
    'attribute'=>'trade_date',  
    'language'=>'zh_cn',  
    'model'=>$model,  
    'options'=>array(  
        'showAnim'=>'fold',
        'minDate'=>'new Date()',  
        'dateFormat'=>'yy-mm-dd',
    ),  
));
}
else
{
	echo $form->textField($model,'trade_date',array('size'=>30,'readonly'=>true));
}
?> 
<?php echo $form->error($model,'trade_date'); ?>
</td>
        </tr>
        <tr>
          <th width="25%" align="left"><?php echo $form->label($model,'trade_staff'); ?></th>
          <td id="select">
            <?php echo $form->dropDownList($model,'trade_staff',User::model()->getListDataInDepart(Yii::app()->user->id),array('prompt'=>'---------',)); ?>
            <?php echo $form->error($model,'trade_staff'); ?>
          </td>
        </tr>
        <tr>
          <th align="left">
              <?php echo $form->label($model,'trade_method'); ?>
              <?php if($model->isAttributeRequired('trade_method')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td id="select">
            <?php echo $form->dropDownList($model,'trade_method',BTrademethod::model()->getListDataTreaty(),array('prompt'=>'---------',)); ?>
            <?php echo $form->error($model,'trade_method'); ?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'trade_user_type'); ?>
             <?php if($model->isAttributeRequired('trade_user_type')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td id="select">
            <!-- <?php echo $form->dropDownList($model,'trade_user_type',BUsertype::model()->getListData(),array('prompt'=>'---------',)); ?>
            <?php echo $form->error($model,'trade_user_type'); ?> -->
            <?php echo $form->dropDownList($model,'trade_user_type',BUsertype::model()->getListDataTreaty(),array('prompt'=>'---------','onchange'=>'usertypeChange(\''.$form->getClientId($model,'trade_user_type').'\',\''.$form->getClientId($model,'producttype_code').'\')',)); ?>
            <?php echo $form->error($model,'trade_user_type'); ?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'producttype_code'); ?>
             <?php if($model->isAttributeRequired('producttype_code')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td id="select">
            <?php echo $form->dropDownList($model,'producttype_code',Producttype::model()->getListDataByUserType($model->trade_user_type),array('prompt'=>'---------','onchange'=>'productTypeChange(\''.$form->getClientId($model,'producttype_code').'\',\''.$form->getClientId($model,'product_id').'\');treatyValidate(\''.$form->getClientId($model,'producttype_code').'\',\''.$form->getClientId($model,'trade_number').'\');',)); ?>
            <?php echo $form->error($model,'producttype_code'); ?>
          </td>
        </tr>

        <tr>
          <th align="left">
             <?php echo $form->label($model,'product_id'); ?>
             <?php if($model->isAttributeRequired('product_id')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td id="select">
            <?php echo $form->dropDownList($model,'product_id',Product::model()->getListDataByType($model->producttype_code),array('prompt'=>'---------',)); ?>
            <?php echo $form->error($model,'product_id'); ?>
          </td>
        </tr>
        	
        <tr>
          <th align="left">
             <?php echo $form->label($model,'imei'); ?>
             <?php if($model->isAttributeRequired('imei')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'imei',array('size'=>30,));?>
              <span class='require'>(※手机终端必须填写)</span>
          	  <?php echo $form->error($model,'imei');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'inchannel_code'); ?>
             <?php if($model->isAttributeRequired('inchannel_code')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td id="select">
            <?php echo $form->dropDownList($model,'inchannel_code',BInchannel::model()->getListData($model->producttype_code),array('prompt'=>'---------',)); ?>
            <?php echo $form->error($model,'inchannel_code'); ?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'serialnumber'); ?>
             <?php if($model->isAttributeRequired('serialnumber')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'serialnumber',array('size'=>30,));?>
              <span class='require'>(※合约、号卡类产品必须填写)</span>
          	  <?php echo $form->error($model,'serialnumber');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'treatyyear'); ?>
             <?php if($model->isAttributeRequired('treatyyear')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td>
            <?php echo $form->dropDownList($model,'treatyyear',Yii::app()->params['treatyDropDown']); ?>月
          	<?php echo $form->error($model,'treatyyear');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'discnt_code'); ?>
             <?php if($model->isAttributeRequired('discnt_code')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td id="select">
            <?php echo $form->dropDownList($model,'discnt_code',BDiscnt::model()->getListData(),array('prompt'=>'---------',)); ?>
            <?php echo $form->error($model,'discnt_code'); ?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'trade_number'); ?>
             <?php if($model->isAttributeRequired('trade_number')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td id="select">
            <?php echo $form->textField($model,'trade_number',array('size'=>20,'class'=>'number','onchange'=>'autoSum([\''.$form->getClientId($model,'bill_fee').'\',\''.$form->getClientId($model,'phone_fee').'\',\''.$form->getClientId($model,'card_fee').'\',\''.$form->getClientId($model,'rbill_fee').'\'],\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'trade_number').'\');autoMinus(\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'discount_money').'\',\''.$form->getClientId($model,'trade_money').'\',\''.$form->getClientId($model,'trade_number').'\');'));?>
            <?php echo $form->error($model,'trade_number'); ?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'bill_fee'); ?>
             <?php if($model->isAttributeRequired('bill_fee')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'bill_fee',array('size'=>20,'class'=>'number','onchange'=>'autoSum([\''.$form->getClientId($model,'bill_fee').'\',\''.$form->getClientId($model,'phone_fee').'\',\''.$form->getClientId($model,'card_fee').'\',\''.$form->getClientId($model,'rbill_fee').'\'],\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'trade_number').'\');autoMinus(\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'discount_money').'\',\''.$form->getClientId($model,'trade_money').'\',\''.$form->getClientId($model,'trade_number').'\');'));?>元
          	  <?php echo $form->error($model,'bill_fee');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'phone_fee'); ?>
             <?php if($model->isAttributeRequired('phone_fee')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'phone_fee',array('size'=>20,'class'=>'number','onchange'=>'autoSum([\''.$form->getClientId($model,'bill_fee').'\',\''.$form->getClientId($model,'phone_fee').'\',\''.$form->getClientId($model,'card_fee').'\',\''.$form->getClientId($model,'rbill_fee').'\'],\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'trade_number').'\');autoMinus(\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'discount_money').'\',\''.$form->getClientId($model,'trade_money').'\',\''.$form->getClientId($model,'trade_number').'\');'));?>元
          	  <?php echo $form->error($model,'phone_fee');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'card_fee'); ?>
             <?php if($model->isAttributeRequired('card_fee')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'card_fee',array('size'=>20,'class'=>'number','onchange'=>'autoSum([\''.$form->getClientId($model,'bill_fee').'\',\''.$form->getClientId($model,'phone_fee').'\',\''.$form->getClientId($model,'card_fee').'\',\''.$form->getClientId($model,'rbill_fee').'\'],\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'trade_number').'\');autoMinus(\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'discount_money').'\',\''.$form->getClientId($model,'trade_money').'\',\''.$form->getClientId($model,'trade_number').'\');'));?>元
          	  <?php echo $form->error($model,'card_fee');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'rbill_fee'); ?>
             <?php if($model->isAttributeRequired('rbill_fee')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'rbill_fee',array('size'=>20,'class'=>'number','onchange'=>'autoSum([\''.$form->getClientId($model,'bill_fee').'\',\''.$form->getClientId($model,'phone_fee').'\',\''.$form->getClientId($model,'card_fee').'\',\''.$form->getClientId($model,'rbill_fee').'\'],\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'trade_number').'\');autoMinus(\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'discount_money').'\',\''.$form->getClientId($model,'trade_money').'\',\''.$form->getClientId($model,'trade_number').'\');'));?>元
          	  <?php echo $form->error($model,'rbill_fee');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'all_fee'); ?>
             <?php if($model->isAttributeRequired('all_fee')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'all_fee',array('size'=>20,'class'=>'number','readonly'=>'true'));?>元
          	  <?php echo $form->error($model,'all_fee');?>
          </td>
        </tr>
        <tr id="sp_price" >
          <th align="left">付款方式 </th>
          <td><table border="0" cellpadding="0" cellspacing="0" class="normal" width="100%">
              <tr>
		          <th align="left">
		             <?php echo $form->label($model,'check_money'); ?>
		             <?php if($model->isAttributeRequired('check_money')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
		          </th>
		          <td><?php echo $form->textField($model,'check_money',array('size'=>20,'class'=>'number',));?>元
		          	  <?php echo $form->error($model,'check_money');?>
		          </td>
              </tr>
              <tr>
		          <th align="left">
		             <?php echo $form->label($model,'ready_money'); ?>
		             <?php if($model->isAttributeRequired('ready_money')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
		          </th>
		          <td><?php echo $form->textField($model,'ready_money',array('size'=>20,'class'=>'number',));?>元
		          	  <?php echo $form->error($model,'ready_money');?>
		          </td>
              </tr>
              <tr>
		          <th align="left">
		             <?php echo $form->label($model,'pos_money'); ?>
		             <?php if($model->isAttributeRequired('pos_money')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
		          </th>
		          <td><?php echo $form->textField($model,'pos_money',array('size'=>20,'class'=>'number',));?>元
		          	  <?php echo $form->error($model,'pos_money');?>
		          </td>
              </tr>
            </table></td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'discount_money'); ?>
             <?php if($model->isAttributeRequired('discount_money')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'discount_money',array('size'=>20,'class'=>'number','onchange'=>'autoMinus(\''.$form->getClientId($model,'all_fee').'\',\''.$form->getClientId($model,'discount_money').'\',\''.$form->getClientId($model,'trade_money').'\');'));?>元
          	  <?php echo $form->error($model,'discount_money');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'trade_money'); ?>
             <?php if($model->isAttributeRequired('trade_money')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'trade_money',array('size'=>20,'class'=>'number','readonly'=>'true'));?>元(※合计-折扣)
          	  <?php echo $form->error($model,'trade_money');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'discount_minus'); ?>
             <?php if($model->isAttributeRequired('discount_minus')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textField($model,'discount_minus',array('size'=>20,'class'=>'number',));?>元
          	  <?php echo $form->error($model,'discount_minus');?>
          </td>
        </tr>
        <tr>
          <th align="left">
             <?php echo $form->label($model,'remark'); ?>
             <?php if($model->isAttributeRequired('remark')) echo CHtml::tag('span',array('class'=>'require'),'*')?>
          </th>
          <td><?php echo $form->textArea($model,'remark',array('size'=>20,'style'=>'width:98%;','rows'=>5,));?>
          	  <?php echo $form->error($model,'remark');?><br />
              (※销退须注明ESS原销售单号)
          </td>
        </tr>
      </table>
      <p class="inquiry">
      	<?php echo CHtml::submitButton('提交订单',array('class'=>'btn'))?>
      	<?php echo CHtml::resetButton('取消',array('class'=>'btn'))?>
      </p>
<?php $this->endWidget(); ?>
<!--    </form>-->
    <div class="content-link"><?php echo CHtml::link('▲页面顶部','#wrapper');?></div>
    <!--div.section -->
  </div>
  <!--div#content -->
</div>
<!-- div#content end -->
